package com.ruoyi.web.controller.wx;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.AppCreateJobBill;
import com.ruoyi.system.service.impl.EnterpriseWXServiceImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("wx/send")
public class WxSendController {

    @Resource
    private EnterpriseWXServiceImpl enterpriseWXService;

    @GetMapping("/message")
    public AjaxResult message(@RequestBody AppCreateJobBill appCreateJobBill) {
        EnterpriseWXServiceImpl.SendMessageRequest sendMessageRequest = new EnterpriseWXServiceImpl.SendMessageRequest();
        sendMessageRequest.setTouser(appCreateJobBill.getCreatedBy());
        sendMessageRequest.setMsgtype("text");
        sendMessageRequest.setAgentid(1000319);
        EnterpriseWXServiceImpl.MessageContent messageContent = new EnterpriseWXServiceImpl.MessageContent();
        messageContent.setContent("特殊作业签票，测试中！");
        sendMessageRequest.setText(messageContent);
        enterpriseWXService.pushMessage(sendMessageRequest);
        return AjaxResult.success();
    }

}
